package com.hc.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hc.common.bean.PageBean;
import com.hc.domain.User;
import com.hc.query.AuthorVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.hc.mapper.AuthorMapper;
import com.hc.domain.Author;
import com.hc.service.AuthorService;

import java.util.List;

/**
 * @author: hecai
 * @date: 2021/11/10 14:09
 * @description: 
 */
@Service
public class AuthorServiceImpl implements AuthorService{

    @Resource
    private AuthorMapper authorMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return authorMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Author record) {
        return authorMapper.insert(record);
    }

    @Override
    public int insertSelective(Author record) {
        return authorMapper.insertSelective(record);
    }

    @Override
    public PageBean<Author> selectPageByCondition(Integer pageNum, Integer pageSize, AuthorVO authorVO) {
        Page<Author> page = PageHelper.startPage(pageNum, pageSize);
        authorMapper.selectAuthorsByCondition(authorVO);
        PageBean<Author> pageBean = PageBean.init(page);
        return pageBean;
    }

    @Override
    public Author selectByPrimaryKey(Long id) {
        return authorMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Author record) {
        return authorMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Author record) {
        return authorMapper.updateByPrimaryKey(record);
    }

    @Override
    public Author selectByName(String name) {
        return authorMapper.selectByName(name);
    }

    @Override
    public List<Long> selectAuthorIdsByName(String[] names) {
        return authorMapper.selectAuthorIdsByName(names);
    }

    @Override
    public int avctiveByPrimaryKey(Long id) {
        return authorMapper.avctiveByPrimaryKey(id);
    }

    @Override
    public int disabledByPrimaryKey(Long id) {
        return authorMapper.disabledByPrimaryKey(id);
    }

    @Override
    public String selectNameByPrimaryKey(Long id) {
        return authorMapper.selectNameByPrimaryKey(id);
    }
}
